//
//  GCMineMenuViewController.m
//  GoldChampion
//
//  Created by Mac on 2018/4/11.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "GCMineMenuViewController.h"
#import "GCMenuBaguaViewController.h"
#import "GCMenuMessageViewController.h"
#import "GCMenuSlefMessageViewController.h"
#import "GCSendSelfMessgaeViewController.h"
@interface GCMineMenuViewController ()
@property(nonatomic, strong) STSegementButton     *segementButton;
@property(nonatomic, strong) UIScrollView     *scrollView;
@end

@implementation GCMineMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self st_setRightItemWithImage:[UIImage imageNamed:@"信息798"]];
    __weak typeof(self) weakSelf =  self;
    self.segementButton = [[STSegementButton alloc] initWithFrame:CGRectMake(0, [TMUtils navgationBarBootom], UIScreenWidth/2, 40)
                                                         andTitle:@[@"八卦",@"消息",@"私信"] handle:^(STSegementButton *sender) {
                                                             if (weakSelf.segementButton.cureentIndex == 1) {
                                                                 [weakSelf.scrollView setContentOffset:CGPointMake(UIScreenWidth, 0) animated:YES];
                                                             }else if(weakSelf.segementButton.cureentIndex == 2){
                                                                 [weakSelf.scrollView setContentOffset:CGPointMake(2*UIScreenWidth, 0) animated:YES];
                                                             }
                                                             else if(weakSelf.segementButton.cureentIndex == 3){
                                                                 [weakSelf.scrollView setContentOffset:CGPointMake(3*UIScreenWidth, 0) animated:YES];
                                                             }
                                                             else{
                                                                 [weakSelf.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
                                                             }
                                                             // [weakSelf.tableView reloadData];
                                                         }];
    self.segementButton.backgroundColor = [UIColor whiteColor];
    self.segementButton.lineSelectedColor = TM_redColor;
    self.segementButton.butTitleSelectedColor = TM_redColor;
    self.segementButton.butTitleColor = TM_secendTextColor;
    self.segementButton.lineColor = [UIColor whiteColor];
    self.segementButton.cureentIndex = 0;
    self.segementButton.autoMoveWithClic = YES;
    self.navigationItem.titleView = self.segementButton;
    
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, [TMUtils navgationBarBootom], UIScreenWidth, [TMUtils tabBarTop] - [TMUtils navgationBarBootom] + 49)];
    self.scrollView.scrollEnabled = NO;
    self.scrollView.backgroundColor = [UIColor whiteColor];
    self.scrollView.contentSize = CGSizeMake(3 * UIScreenWidth, 0);
    [self.view addSubview:self.scrollView];
    
    GCMenuBaguaViewController * vc =  [GCMenuBaguaViewController new];
    [self addChildViewController:vc];
    UIView * view = vc.view;
    [self.scrollView addSubview:view];
    
    GCMenuMessageViewController * taijiVC = [GCMenuMessageViewController new];
    [self addChildViewController:taijiVC];
    UIView * listView = taijiVC.view;
    listView.left= UIScreenWidth;
    [self.scrollView addSubview:listView];
    
    
    GCMenuSlefMessageViewController * zhizhiVC = [GCMenuSlefMessageViewController new];
    [self addChildViewController:zhizhiVC];
    UIView * zhizhiView = zhizhiVC.view;
    zhizhiView.left= UIScreenWidth * 2;
    [self.scrollView addSubview:zhizhiView];
    
    
    
    // Do any additional setup after loading the view.
}

- (void)st_rightBarAction:(id)sender{
    [self.navigationController pushViewController:[GCSendSelfMessgaeViewController new] animated:YES];
}
@end
